package com.gurumades.jsonform.shared.dispatch;

import java.util.Map;

@SuppressWarnings("rawtypes")
public abstract class JsonHelper {
	
	public abstract Map wrapItem(Object jsonImpl);
	
	public boolean getBoolean(Map json, String key, boolean defaults){
		Boolean bool = (Boolean) json.get(key);
		
		if (bool == null) {
			return defaults;
		}
		return bool;
	}
	
	public String getString(Map json, String key, String defaults){
		String str = (String) json.get(key);
		
		if (str == null) {
			return defaults;
		}
		return str;
	}
	
	public int getInt(Map json, String key, int defaults){
		Integer str = (Integer) json.get(key);
		
		if (str == null) {
			return defaults;
		}
		return str;
	}

}
